package dart

class Util {

	static public void validateScoreParam(Map params, String property) {
		params[property] = (params[property].isFloat() ? params[property] : null);
		params[property] = Util.roundToValidScore(params[property] as Float);
	}

	static public Float roundToValidScore(Float score) {
		if (score == null)
			return null;

		Float tmpScore = score.abs();

		Float base = tmpScore.intValue()
		Float decimal = tmpScore - base;
		decimal = (decimal < 0.25 ? 0.0 : (decimal >= 0.75 ? 1.0 : 0.5))

		tmpScore = base + decimal;


		return (score < 0 ? -(tmpScore) as Float : tmpScore);
	}
}